#ifndef __CORE_ANGLES__
#define __CORE_ANGLES__
#include <stdlib.h>
#include <string>

namespace Core
{
	class rtVector3;
	class rtMatrix3;
	class rtMatrix4;
	class rtQuaternions;
	class rtRotation;

	class rtAngles
	{
	public:
		float			pitch;
		float			yaw;
		float			roll;

		static rtAngles ang_zero;

		rtAngles(void);
		rtAngles(float pitch, float yaw, float roll);
		explicit rtAngles(const rtVector3& v);
		
		void 			set(float pitch, float yaw, float roll);
		rtAngles&		zero(void);

		float			operator [] (int index) const;
		float&			operator [] (int index);
		rtAngles		operator - () const;
		rtAngles&		operator = (const rtAngles& a);
		rtAngles		operator + (const rtAngles& a) const;
		rtAngles&		operator += (const rtAngles& a);
		rtAngles		operator - (const rtAngles& a) const;
		rtAngles&		operator -= (const rtAngles& a);
		rtAngles		operator * (const float a) const;
		rtAngles&		operator *= (const float a);
		rtAngles		operator / (const float a) const;
		rtAngles&		operator /= (const float a);

		friend rtAngles	operator * (const float a, const rtAngles& b);

		bool			compare(const rtAngles& a) const;
		bool			compare(const rtAngles& a, const float epsilon) const;
		bool			operator==(const rtAngles& a) const;
		bool			operator!=(const rtAngles& a) const;

		rtAngles&		normalize360(void);
		rtAngles&		normalize180(void);

		void			clamp(const rtAngles& min, const rtAngles& max);

		int				getDimension(void) const;

		void			toVectors(rtVector3* forward, rtVector3* right = NULL, rtVector3* up = NULL) const;
		rtVector3		toForward(void) const;
		rtQuaternions	toQuat(void) const;
		rtRotation		toRotation(void) const;
		rtMatrix3		toMat3(void) const;
		rtMatrix4		toMat4(void) const;
		rtVector3		toAngularVelocity(void) const;
		const float*	toFloatPtr(void) const;
		float*			toFloatPtr(void);
	};
}
#endif

